<template>
  <div class="wrapper">
    <div class="top-bar">
      <div class="title">
        <img v-if="titleCustomerIcon" :src="titleCustomerIcon" @click="handleLogoClick" />
        <img src="../../assets/home/governmentIcon.png" @click="handleLogoClick" v-else />
        <span @click="handleLogoClick"> {{ pageTitle }} </span>
      </div>
    </div>
    <mineAvatar :isMine="true" />
    <div class="content-container">
      <searchBox ref="searchBox" class="search-box" :hideHistory="true"></searchBox>
      <div class="main">
        <div class="header-wrapper">
          <div class="header">
            <div class="header-item">
              <img class="back-btn" :src="backBtn" @click="handleBackBtnClick" alt="" />
            </div>
            <div class="title">
              <span class="mine">我的</span>
              <span :class="{
                  mineTabItem: true,
                  active: mineTabSelectedValue == item.value
                }" v-for="(item, index) in mineTabList" :key="index"
                @click="handleMineTabClick(item)">{{ item.name }}</span>
            </div>
          </div>
        </div>
        <div class="main-content">
          <!-- 内容在这里 -->
          <MyResume v-if="mineTabSelectedValue == '1'" />
          <Collection v-if="mineTabSelectedValue == '2'" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Collection from "./collection";
import MyResume from "./myResume";
import searchBox from "./components/searchBox";
import mineAvatar from "../home/components/mineAvatar";
export default {
  name: "Mine",
  components: {
    searchBox,
    Collection,
    MyResume,
    mineAvatar,
  },
  data() {
    return {
      SecretKey:
        this.$route.query.SecretKey || localStorage.getItem("SecretKey"),
      mineTabSelectedValue: 1,
      titleCustomerIcon: "",
      mineTabList: [
        {
          name: "我的简历",
          value: 1,
        },
        {
          name: "收藏",
          value: 2,
        },
      ],
      pageTitle: "",
      backBtn: require("../../icons/backBtn.png"),
      currentReportType: "recruitment_allocation_report",
      isShowPosition: true,
    };
  },
  mounted() {
    this.isSuperToken =
      localStorage.getItem("superToken") ==
        "407404EAEC845F1B91A104B80FE86D89" ||
      localStorage.getItem("superToken") == "5FD271D8A0AA315DD218801C0C3A0DEA";

    const customerDesc = localStorage.getItem(
      "customerDesc",
      this.customerDesc
    );
    document.title = customerDesc || "一览职业大全";
    if (
      this.$route.query.superToken == "407404EAEC845F1B91A104B80FE86D89" ||
      this.$route.query.superToken == "5FD271D8A0AA315DD218801C0C3A0DEA"
    ) {
      this.specialHidden = false;
    }
    let SecretKey =
      this.$route.query.SecretKey || localStorage.getItem("SecretKey");
    //河南测绘学院隐藏校招岗位
    if (SecretKey == "94cbe78f3bcec8be756042d1554c13b5") {
      this.isShowPosition = false;
      this.mineTabList = [
        // {
        //   name: "我的简历",
        //   value: 1,
        // },
        {
          name: "收藏",
          value: 2,
        },
      ];
      this.mineTabSelectedValue = 2;
    }
  },
  created() {
    this.titleCustomerIcon = localStorage.getItem("extra")
      ? JSON.parse(localStorage.getItem("extra")).icon
      : "";
    // console.log(this.titleCustomerIcon, 'titleCustomerIcon');
    const openUpload = this.$route.query.openUpload;
    if (openUpload == "true") {
      this.$bus.$emit("uploadResume");
    }
    this.pageTitle = localStorage.getItem("customerDesc") || "一览职业大全";
  },
  methods: {
    handleMineTabClick(item) {
      this.mineTabSelectedValue = item.value;
    },
    handleBackBtnClick() {
      this.$router.go(-1);
    },
    handleLogoClick() {
      this.$router.push({
        path: "/position",
        query: {
          superToken: this.$route.query.superToken || "",
        },
      });
    },
  },
};
</script>
<style scoped lang="scss">
$main-color: #0b6eff;
@keyframes popupAnimation {
  0% {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}
.wrapper {
  position: relative;
  background: #f7f8fa;
  height: 100%;
  font-size: 14px;
}

.top-bar {
  position: fixed;
  display: flex;
  align-items: center;
  height: 57px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(7px);
  background-size: 100% 57px;
  z-index: 2;
  .title {
    display: flex;
    align-items: center;
    padding-left: 25px;
    color: #fff;
    font-size: 17px;
    line-height: 24px;
    letter-spacing: 2px;
    font-family: "title-home-font";
    max-width: 26vw;
    span {
      cursor: pointer;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-inline-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 1;
    }
    img {
      height: 24px;
      width: auto;
      cursor: pointer;
      margin-right: 5px;
    }
  }
}
.content-container {
  width: 100%;
  height: 100%;
  display: flex;
  background: url("../../assets/home/back.png") no-repeat;
  flex-direction: column;
  background-size: 100.1% auto;
  align-items: center;
  font-family: PingFangSC-Medium, PingFang SC;
  .search-box {
    margin-top: 8px !important;
    width: auto !important;
  }
  .main {
    height: calc(100vh - 78px);
    position: relative;
    border-radius: 20px 20px 0 0;
    margin-top: 24px;
    background-color: #f7f8fa;
    margin-left: 24px;
    margin-right: 24px;
    width: calc(100vw - 48px);
    overflow-y: hidden;
    min-width: 1200px;
    .header-wrapper {
      padding-bottom: 18px;
      background-color: #fff;
      .header {
        display: flex;
        align-items: center;
        // padding: 0px 0 6px 0;
        margin-left: 50px;
        border-bottom: 1px solid #cfd8f5;
        &-item {
          display: flex;
          align-items: center;
        }
        .back-btn {
          width: 36px;
          height: 36px;
          position: absolute;
          left: 16px;
          top: 16px;
          cursor: pointer;
        }
        .title {
          display: flex;
          align-items: center;
          margin-left: 30px;
          .mine {
            font-size: 22px;
            color: #222;
            font-family: PingFangSC-Medium, PingFang SC;
            margin-right: 28px;
          }
          .mineTabItem {
            font-size: 16px;
            font-family: PingFangSC-Medium, PingFang SC;
            padding-bottom: 5px;
            color: #999;
            margin: 24px 26px 0;
            cursor: pointer;
            &.active {
              border-bottom: 2px solid $main-color;
              color: $main-color;
            }
          }
        }
      }
    }
    .ml14 {
      margin-left: 14px;
    }
    .main-content {
      display: flex;
      flex: 1;
      width: 100%;
      height: 100%;
      box-shadow: 0px 24px 32px -22px #d7e3f8 inset;
      min-width: 1200px;
      .not-visible {
        visibility: hidden;
      }
      .report-list {
        width: 175px;
        height: 100%;
        flex-shrink: 0;
        background-color: #fff;
        box-shadow: 0px 30px 32px -22px #d7e3f8 inset;
        position: relative;
        .title {
          font-size: 18px;
          color: #222;
          text-align: center;
          padding: 16px 0 12px 0;
        }
        .add-btn {
          display: flex;
          justify-content: center;
          align-items: center;
          border: 1px solid $main-color;
          border-radius: 4px;
          padding: 3px 0;
          width: 145px;
          margin: 0 auto;
          cursor: pointer;
          user-select: none;
          color: $main-color;
          .add-img {
            margin-right: 8px;
            font-weight: 600;
            font-size: 14px;
          }
        }
        .btn-bar {
          display: flex;
          align-items: center;
          margin-left: 16px;
          .btn {
            padding: 3px 12px;
            border-radius: 2px;
            border: 1px solid $main-color;
            color: $main-color;
            cursor: pointer;
            user-select: none;
            &:hover {
              color: $main-color;
              border-color: $main-color;
            }
          }
        }
        .list {
          flex-shrink: 0;
          padding: 8px 0 0 0;
          height: calc(100% - 183px);
          &-item {
            display: flex;
            align-items: center;
            cursor: pointer;
            padding: 9px 0 9px 15px;
            margin: 4px 10px 4px 0;
            position: relative;
            .download-status {
              position: absolute;
              right: 8px;
              top: 8px;
              width: 5px;
              height: 5px;
              border-radius: 50%;
              background-color: #f06060;
            }
            &-name {
              font-family: Helvetica Neue, Helvetica, PingFang SC,
                Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              padding-left: 6px;
              user-select: none;
              font-size: 16px;
              flex: 1;
              color: #999;
              &:hover {
                color: $main-color;
              }
            }
            .custom-checkbox {
              // ::v-deep .el-checkbox__inner {
              //   width: 12px;
              //   height: 12px;
              //   border-radius: 3px;
              //   background: transparent;
              // }
              // ::v-deep .el-checkbox__label {
              //   padding-left: 4px;
              // }
              // ::v-deep .el-checkbox__input.is-checked .el-checkbox__inner,
              // .el-checkbox__input.is-indeterminate .el-checkbox__inner {
              //   background: transparent;
              // }
              // ::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
              //   color: #fff;
              // }
              // ::v-deep .el-checkbox__inner::after {
              //   left: 3px;
              //   height: 5px;
              //   width: 3px;
              //   border-left: 0;
              //   border-top: 0;
              // }
            }
            .checkboxActive {
              color: $main-color;
            }
          }
          .active {
            background: $main-color;
            border-radius: 0 8px 8px 0;
            .list-item-name {
              color: #fff;
            }
          }
          .multiple-active {
            background-color: #e4e9f1;
            border-radius: 0 8px 8px 0;
          }
        }
        .clear {
          padding: 12px 0 12px 14px;
          cursor: pointer;
          color: #999999;
          display: flex;
          align-items: center;
          &-text {
            padding-left: 6px;
          }
        }
      }
      .preview-wrap {
        flex: 1;
        min-width: 900px;
        overflow-x: auto;
        .preview-content {
          height: calc(100% - 90px);
          margin: 16px 12px 0 12px;
          border: 1px solid #e8eefa;
          border-bottom: none;
          border-radius: 10px 10px 0 0;
          overflow: hidden;
          position: relative;
          background-color: #fff;
          .preview-text {
            position: absolute;
            background: #fff;
            z-index: 99;
            width: 53px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            top: 0;
            left: 0;
            border-radius: 10px 0px 13px 0px;
            background-color: #eaedf4;
            color: #222;
          }
          .empty {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 16px;
            height: 100%;
            color: #a9a9a9;
          }
        }
        .shadow {
          height: calc(100% - 144px);
          box-shadow: #b3d0f5 0px -10px 12px -14px inset;
        }
        .footer-wrapper {
          height: 60px;
          border-left: 1px solid #e8eefa;
          border-right: 1px solid #e8eefa;
          margin: 0 12px 0 12px;
          .footer {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 58px;
            background-color: #fff;
            .download-btn {
              display: block;
              padding: 10px 32px;
              border-radius: 5px;
              font-size: 16px;
              font-family: PingFangSC-Medium, PingFang SC;
              cursor: pointer;
              user-select: none;
            }
            .multiple {
              background-color: #fff;
              color: $main-color;
              border: 1px solid $main-color;
            }
            .single {
              color: #fff;
              margin-left: 16px;
              background: $main-color;
            }
            .producing {
              cursor: not-allowed;
            }
            .mr16 {
              margin-right: 16px;
            }
            .ml16 {
              margin-left: 16px;
            }
          }
        }
      }
      .preview-type {
        width: 153px;
        height: 202px;
        flex-shrink: 0;
        box-shadow: 0px 30px 32px -22px #d7e3f8 inset;
        background-color: #fff;
        .title {
          padding: 24px 15px 0 15px;
          font-size: 18px;
          color: #222222;
        }
        .all-type {
          margin: 12px 0 4px 16px;
        }
        .type-list {
          background-color: #fff;
          margin-top: 12px;
          &-item {
            padding: 6px 15px;
            margin: 10px 0;
            cursor: pointer;
            display: flex;
            &:hover {
              color: $main-color;
            }
            &-name {
              margin-left: 8px;
              color: #888888;
            }
          }
          .active {
            color: $main-color;
            background-color: #ebf1f7;
          }
        }
      }
    }
  }
}

.dot-ani {
  display: inline-block;
  height: 12px;
  line-height: 12px;
  overflow: hidden;
}
.dot-ani::after {
  display: inline-table;
  white-space: pre;
  content: "\A.\A..\A...";
  animation: spin 2s steps(4) infinite;
}
@keyframes spin {
  to {
    -webkit-transform: translateY(-48px);
    transform: translateY(-48px);
  }
}

::v-deep .el-scrollbar .el-scrollbar__wrap {
  overflow-x: hidden;
}

::v-deep .el-menu {
  width: 175px;
  border-right: 0px;
  background: #f5f5f5;
}
::v-deep .el-menu-item {
  padding: 0;
  min-width: 145px;
  height: 41px;
  line-height: 41px;
  color: #999999;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
}
::v-deep .el-submenu__title {
  height: 41px;
  font-size: 16px;
  line-height: 41px;
  padding-left: 16px !important;
  color: #999999;
  background: #fff;
  // overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
::v-deep .el-menu-item.is-active {
  color: $main-color;
}
::v-deep .el-submenu.is-active > .el-submenu__title {
  color: #fff;
  padding-left: 9px !important;
  margin-left: 12px;
  background: $main-color;
  border-radius: 8px;
  &::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 41px;
    background: $main-color;
    position: absolute;
    left: -12px;
    border-radius: 8px;
  }
  .el-icon-arrow-down:before {
    color: #fff;
  }
}
::v-deep .el-tabs__content {
  border-left: 1px solid #e8e8e8;
  padding-left: 36px;
}
::v-deep.el-tabs--left .el-tabs__header.is-left {
  margin-right: 0;
}
::v-deep.el-tabs--left .el-tabs__item.is-left {
  text-align: left;
}
::v-deep .el-submenu__title > span {
  padding-left: 20px;
}
::v-deep .el-tabs__item {
  height: 48px;
}

.content {
  color: #222222;
  font-size: 13px;
  font-family: PingFangSC-Regular;
  display: flex;
  flex: 1;
  overflow-y: auto;
  height: calc(100vh - 150px);
  overflow-x: scroll;
  // border-left: 1px solid #eaedf7;
  &::-webkit-scrollbar {
    width: 4px;
    background-color: #fff;
    border-radius: 4px;

    height: 4px;
  }
  &::-webkit-scrollbar-thumb {
    background-color: #d8d8d8;
    border-radius: 4px;
  }
}

::-webkit-scrollbar {
  width: 4px;
  background-color: #fff;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background-color: #d8d8d8;
  border-radius: 4px;
}
::v-deep .el-textarea__inner::-webkit-scrollbar {
  width: 5px;
  background-color: #fff;
  border-radius: 4px;
}
::v-deep .el-textarea__inner::-webkit-scrollbar-thumb {
  background-color: #d8d8d8;
  border-radius: 4px;
}
::v-deep .el-submenu__title > span {
  padding-left: 0;
}
button:focus {
  outline: none;
}
button:hover {
  cursor: pointer;
}
::v-deep .el-date-editor .el-range-input {
  color: #999999;
  background-color: #fafcfe;
}
::v-deep .el-range-editor--small .el-range__icon {
  display: none;
}
::v-deep .el-checkbox {
  .el-checkbox__inner {
    border-radius: 3px;
    background: transparent;
    border-color: #9c9c9c;
  }
  .el-checkbox__input.is-checked .el-checkbox__inner {
    border-color: $main-color;
  }
  .el-checkbox__inner::after {
    border: 1px solid $main-color;
    border-left: 0;
    border-top: 0;
  }
}
</style>
